package com.aos.demo.customer;

import com.aos.demo.DemoApplication;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Deprecated
public class CustomerController {

    private final CustomerService customerService;

    public CustomerController(CustomerService customerService){
         this.customerService = customerService;
    }

    @GetMapping
    List<Customer> getCustomers(){
        return customerService.getCustomers();
    }

    @PostMapping
    void createNewCustomer(@RequestBody Customer customer){
        System.out.println("POST 请求");
        System.out.println(customer);
    }

    @PutMapping
    void updateCustomer(@RequestBody Customer customer){
        System.out.println("UPDATE 请求");
        System.out.println(customer);
    }

    @DeleteMapping(path = "{customerID}")
    void deleteCustomer(@PathVariable("customerID") Long id){
        System.out.println("DELETE 请求，删除 Customer,ID 为" + id);
    }

}
